package com.qili.service.affairCase;

import com.qili.base.mapper.BaseMapper;
import com.qili.base.service.impl.BaseServiceImpl;
import com.qili.entity.affaircase.AffairRecord;

import com.qili.entity.affaircase.dto.AffairRecordDTO;
import com.qili.mapper.affairCase.AffairRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhaoyongke
 * @date 2020/11/13
 * @description  流程记录
 */
@Service
public class AffairRecordService extends BaseServiceImpl<AffairRecord,String> {
    @Autowired
    AffairRecordMapper affairRecordMapper;

    @Override
    public BaseMapper<AffairRecord, String> getMappser() {
        return affairRecordMapper;

    }

    public List<AffairRecordDTO> selectRecord(AffairRecordDTO dto) {
        return affairRecordMapper.selectRecord(dto);
    }

    /**
     * @param caseId
     * @param operId
     * @Author:zhaoyongke
     * @Description: 根据操作人 caseId 获取 remark
     * @Date:16:03 2021/2/1
     */
    public AffairRecordDTO getReamrKByOper(String caseId, String operId) {
        AffairRecordDTO affairRecord = new AffairRecordDTO();
        affairRecord.setYwId(caseId);
        affairRecord.setOperUserId(operId);
        affairRecord.setHjName("签字");
        List<AffairRecordDTO> selectRecord = affairRecordMapper.selectRecord(affairRecord);
        if (selectRecord.size() > 0) {
            affairRecord = selectRecord.get(0);
            return  affairRecord;
        }else{
            return  null;
        }
    }

}
